<?php
class Zendvn_Captcha_Image extends Zend_Captcha_Image {
	
	public function __construct($options = null){
		//$captcha = new Zend_Captcha_Image();
		$this->setImgDir(FILE_PATH . '/captcha/img');
		$this->setImgUrl(FILE_URL . '/captcha/img');
		$this->setTimeout(300);
		$this->setWordlen(3);
		$this->setWidth(250);
		if(!empty($options['width'])){
			$this->setWidth($options['width']);
		}
		
		$this->setHeight(70);
		if (!empty($options['height'])){
			$this->setWidth($options['height']);
		}
		$this->setFont(FILE_PATH . '/captcha/font/TIMES.TTF');
		$this->setFontSize(40);
		
		//tao captcha
		$captcha = $this->generate();

		$ssCaptcha = 'Zend_From_Captcha_'.$this->getId();
		$ss = new Zend_Session_Namespace($ssCaptcha);
		$ss->word = $this->getWord();
		return $captcha;
	}
	
}